﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using System.Text;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Pibby.Core.Persistence;

namespace Pibby.Core.Tests
{
	[TestClass]
	public class ApplicationVersionTests
	{
		[TestMethod]
		public void Create_FromVersion_MatchesVersion()
		{
			Version version = Assembly.GetExecutingAssembly().GetName().Version;

			ApplicationVersion av = new ApplicationVersion(version);

			Assert.AreEqual(version.Major, av.Major);
			Assert.AreEqual(version.Minor, av.Minor);
			Assert.AreEqual(version.Build, av.Build);
			Assert.AreEqual(version.Revision, av.Revision);
		}

		[TestMethod]
		public void Version_FromProperties_MatchesVersion()
		{
			Version version = Assembly.GetExecutingAssembly().GetName().Version;

			ApplicationVersion av = new ApplicationVersion();

			av.Major = version.Major;
			av.Minor = version.Minor;
			av.Build = version.Build;
			av.Revision = version.Revision;

			Assert.AreEqual(version.Major, av.Major);
			Assert.AreEqual(version.Minor, av.Minor);
			Assert.AreEqual(version.Build, av.Build);
			Assert.AreEqual(version.Revision, av.Revision);
		}

	}
}
